package GUI;

import javax.swing.ImageIcon;
import javax.swing.JPanel;
import javax.swing.JLabel;
import javax.swing.JScrollPane;
import javax.swing.JTable;
import javax.swing.table.DefaultTableModel;
import java.awt.Font;

@SuppressWarnings("serial")
/**
 * View the logged-in user's borrow history
 * @author Benny
 *
 */
public class UserRecentActivitiesGUI extends JPanel {

	public MainFrame mf;
    public DefaultTableModel searchTableModel;
    private JScrollPane scrollPane;
    public JTable table;
    public DefaultTableModel searchTableModel1;
    private JScrollPane scrollPane1;
    public JTable table1;
    public DefaultTableModel searchTableModel2;
    private JScrollPane scrollPane2;
    public JTable table2;
    /**
	 * Create the panel.
	 *  @param M Instance of the main Frame of the program 
	 */
	public UserRecentActivitiesGUI(MainFrame M) {
		setLayout(null);
		mf=M;
		JLabel lblRecentActivities = new JLabel("Recent Activities");
		lblRecentActivities.setFont(new Font("Segoe UI", Font.BOLD, 16));
		lblRecentActivities.setBounds(236, 12, 235, 14);
		add(lblRecentActivities);
		
		
		
		searchTableModel= new DefaultTableModel();
        searchTableModel.addColumn("#");
        searchTableModel.addColumn("CopyID");
        searchTableModel.addColumn("Book Name");
        searchTableModel.addColumn("Borrow Date");
        searchTableModel.addColumn("Return Date");
        searchTableModel.addColumn("Actual Return Date");
        
        
        scrollPane = new JScrollPane();
        scrollPane.setBounds(10, 83, 596, 134);
        add(scrollPane);
        
        table= new JTable(searchTableModel){
                
                public boolean isCellEditable(int rowIndex, int colIndex) {
                          return false; //Disallow the editing of any cell
                          }
                          };
                
        
        scrollPane.setViewportView(table);
        table.setRowSelectionAllowed(true);
        table.setVisible(true);
        
        searchTableModel1= new DefaultTableModel();
        searchTableModel1.addColumn("Error ID");
        searchTableModel1.addColumn("Error Status");
        searchTableModel1.addColumn("Error Date");
        searchTableModel1.addColumn("Borrow ID");
        
        
        scrollPane1 = new JScrollPane();
        scrollPane1.setBounds(10,245 , 596, 114);
        add(scrollPane1);
        
        table1= new JTable(searchTableModel1){
                
                public boolean isCellEditable(int rowIndex, int colIndex) {
                          return false; //Disallow the editing of any cell
                          }
                          };
                
        
        scrollPane1.setViewportView(table1);
        table1.setRowSelectionAllowed(true);
        table1.setVisible(true);
        
        searchTableModel2= new DefaultTableModel();
        searchTableModel2.addColumn("OrderID");
        searchTableModel2.addColumn("Order Status");
        searchTableModel2.addColumn("Order Date");
        searchTableModel2.addColumn("Copy ID");

        scrollPane2 = new JScrollPane();
        scrollPane2.setBounds(10, 388, 596, 114);
        add(scrollPane2);
        
        table2= new JTable(searchTableModel2){
                
                public boolean isCellEditable(int rowIndex, int colIndex) {
                          return false; //Disallow the editing of any cell
                          }
                          };
                
        
        scrollPane2.setViewportView(table2);
        table2.setRowSelectionAllowed(true);
        table2.setVisible(true);
        
		ImageIcon img = new ImageIcon(getClass().getResource(
                "/util/grad2.jpg"));
		JLabel picLabel = new JLabel(img);
		picLabel.setLocation(0, 0);
		picLabel.setSize(651, 607);
		add(picLabel);

	}
}
